package cn.xej.demo.config;

import cn.xej.demo.service.UserService;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * @Author alicat.xu
 * @Date 2021/11/3 3:30 下午
 */
@Service
public class UserServiceFactory {

    private final Map<String, UserService> map = new HashMap<>();

    public void register(String type,UserService service){
        map.put(type,service);
    }

    public void getAll() {
        for (Map.Entry<String, UserService> entry : map.entrySet()) {
            System.out.println(entry.getKey()+"   "+entry.getValue());
        }
    }
}
